home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
CDE
/
O-Z
/
Print2Pict3.4.cpt
/
Print2Pict 3.4ƒ
/
P2P Extentions ƒ
/
Print to PICS ƒ
/
tools.c
< prev
next >
Wrap
Text File
|
1992-05-24
|
2KB
|
109 lines
/*===================
Utility routines.
© B.Raoult 92
====================*/
#include "tools.h"
/*
Returns the rectangle of a dialog item
*/
Rect GetItemR(DialogPtr dialog, short itemno)
{
Rect box;
short type;
Handle item;
GetDItem(dialog,itemno,&type,&item,&box);
return box;
}
/*
Returns the handle of a dialog item
*/
Handle GetItemH(DialogPtr dialog, short itemno)
{
Rect box;
short type;
Handle item;
GetDItem(dialog,itemno,&type,&item,&box);
return item;
}
/*
Sets a checkbox
*/
void SetCheck(DialogPtr dialog,short itemno,Boolean on_off)
{
SetCtlValue(GetItemH(dialog,itemno),on_off);
}
/*
Get the value of a checkbox
*/
Boolean GetCheck(DialogPtr dialog, short itemno)
{
return GetCtlValue(GetItemH(dialog,itemno));
}
/*
Toggle a checkbox, returns the new status
*/
Boolean ClickCheck(DialogPtr dialog, short itemno)
{
Handle item = GetItemH(dialog,itemno);
SetCtlValue(item,1-GetCtlValue(item));
return GetCtlValue(item);
}
/*
Put a long integer into an edittext.
*/
void Long2Dialog(DialogPtr dialog, short itemno, long value)
{
Str255 buf;
NumToString(value,buf);
SetIText(GetItemH(dialog,itemno),buf);
}
/*
Get a long integer from an edittext.
*/
long Dialog2Long(DialogPtr dialog, short itemno)
{
Str255 buf;
long value;
GetIText(GetItemH(dialog,itemno),buf);
StringToNum(buf,&value);
return value;
}
/*
Checks if color quickdraw is here. I know, I should use Gestalt...
*/
Boolean HasColor(void)
{
SysEnvRec s;
if(SysEnvirons(1,&s) == noErr) return s.hasColorQD;
return false;
}